package com.itheima.vo;

import cn.hutool.core.bean.BeanUtil;
import com.itheima.domain.db.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CardsVo implements Serializable {

    private Integer id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String gender; //性别
    private Integer age; //年龄
    private String[] tags; //用户标签：多个用逗号分隔

    public void setUserInfo(UserInfo userInfo) {
        BeanUtil.copyProperties(userInfo, this);
        tags = userInfo.getTags().split(",");
    }
}
